<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
 
// import Joomla view library
jimport('joomla.application.component.view');
 
/**
 * HTML View class for the Shop Component
 */
class ShopViewProcess extends JView
{
	protected $type = null;
	// Overwriting JView display method
	function display($tpl = null) 
	{
		$app = &JFactory::getApplication(); 
		JRequest::setVar('format', 'raw');
		$type = JRequest::getVar('type');
		$this->type = $type;
		switch($type){
		// get request 
		case "loadaddress":
		$id = JRequest::getInt('idprovince');
			$db =& JFactory::getDBO();
			$query = $db->getQuery(true);
			$query->select('*');
			$query->from('#__shop_address');
			$query->where('parent_id = '.$id);
			$db->setQuery((string)$query);
			$this->address = $db->loadObjectList();
			parent::display($tpl);
		break;
		case "loadmethod":
			$id = JRequest::getInt('idmethod');
			$db =& JFactory::getDBO();
			$query = $db->getQuery(true);
			$query->select('*');
			$query->from('#__shop_method');
			$query->where('id = '.$id);
			$db->setQuery((string)$query);
			$this->method = $db->loadObject();
			parent::display($tpl);
		break;
		
		}
		// Display the view
		$app->close();
	}
}